package animator.phantom.controller;
/*
    Copyright Janne Liljeblad 2006,2007,2008

    This file is part of Phantom2D.

    Phantom2D is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Phantom2D is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Phantom2D.  If not, see <http://www.gnu.org/licenses/>.
*/

import javax.swing.plaf.metal.*;
import javax.swing.plaf.*;
import java.awt.Color;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import animator.phantom.gui.*;

public class PhantomTheme extends OceanTheme
{
	public static Font MENU_FONT = null;
	public static Font CONTROL_FONT = null;
	public static Font BUTTON_FONT = null;

	public static ColorUIResource darker = new ColorUIResource( new Color( 60,60,60 ) );
	public static ColorUIResource middark = new ColorUIResource( new Color( 80,80,80 ) );
	public static ColorUIResource dark = new ColorUIResource( new Color( 100,100,100 ) );
	public static ColorUIResource phantomblue = new ColorUIResource( new Color( 169,192,205 ) );
	public static ColorUIResource lighter = new ColorUIResource( new Color( 180,180,180 ) );
	public static ColorUIResource light = new ColorUIResource( new Color( 200,200,200 ) );
	public static ColorUIResource lightest = new ColorUIResource( new Color( 245,245,245 ) );

	public static ColorUIResource bgColor = new ColorUIResource( ( new JPanel() ).getBackground() );
	public static ColorUIResource selectedColor = new ColorUIResource( new Color( 169, 192, 205 ) );
	public static ColorUIResource black = new ColorUIResource( Color.black );
	public static ColorUIResource green = new ColorUIResource( Color.green );
	public static ColorUIResource white = new ColorUIResource( Color.white );


	static
	{
		MENU_FONT = new Font( "Free Sans", Font.BOLD, 12 );
		if( MENU_FONT.getFamily().equals( "Dialog") )
			MENU_FONT = GUIResources.BASIC_FONT_12;

		CONTROL_FONT = new Font( "Free Sans", Font.BOLD, 12 );
		if( CONTROL_FONT.getFamily().equals( "Dialog") )
			CONTROL_FONT = GUIResources.BASIC_FONT_12;

		BUTTON_FONT = GUIResources.BASIC_FONT_12;

		PHButtonFactory.factoryImpl = new CurrentThemeButtonFactory();
	}

	private final FontUIResource menuFont = new FontUIResource( MENU_FONT );
	private final FontUIResource controlFont = new FontUIResource( CONTROL_FONT );

	public ColorUIResource getWhite() { return lightest; }
	public ColorUIResource getAcceleratorForeground() { return black; }
	public ColorUIResource getSeparatorForeground() { return lighter; }
	public ColorUIResource getSeparatorBackground() { return light; }
	public ColorUIResource getMenuForeground(){ return darker; }

	public ColorUIResource getPrimary2() { return phantomblue; }

	public FontUIResource getMenuTextFont() { return menuFont;}
	public FontUIResource getControlTextFont() { return controlFont;}

	public void addCustomEntriesToTable( UIDefaults table )
	{
		super.addCustomEntriesToTable( table );

		java.util.List buttonGradient = Arrays.asList(new Object[] { new Float(1f),
			new Float(0.7f), bgColor, selectedColor,
			selectedColor });

		Object[] myDefaults = new Object[] {
		"Button.gradient",
		buttonGradient,

		"Button.font",
		BUTTON_FONT,

		"FileView.directoryIcon",
		new IconUIResource( GUIResources.getIcon( GUIResources.folderIcon ) ),
		"FileView.fileIcon",
		new IconUIResource( GUIResources.getIcon( GUIResources.fileIcon ) ),

		"TextField.margin",
		new InsetsUIResource(0, 2, 0, 0)
		};

		table.putDefaults( myDefaults );
	}

}//end class

